<?php
/*
 * 进云智能生成平台
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
 * //邀请客人
 */

defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
if($_RQ['op']=='main'){
	$member=pdo_get('core_members',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_SESSION['uid']));
	$zhuhu=pdo_get('jy_smallquan_household',array('uniacid'=>$_SESSION['uniacid'],'id'=>$item['mid']));
	$acount=pdo_count('jy_smallquan_advise',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']));
	//查询我邀请的访客
	$guests=pdo_getall('jy_smallquan_guest',array('mid'=>$_SESSION['uid'],'uniacid'=>$_SESSION['uniacid']));
	$return['post']=array();
	$return['member']=$member;
	$return['zhuhu']=$zhuhu;
	$return['acount']=$acount;	
	$return['guests']=$guests;	
	exi($return);
}

if($_RQ['op']=='submit'){
	$post=get_postdata();
	$zid=pdo_getcolumn('jy_smallquan_household',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']),'id');
	$insert=array(
		'uniacid'=>$_SESSION['uniacid'],
		'mid'=>$_SESSION['uid'],
		'zid'=>$zid,
		'guestname'=>$post['name'],
		'num'=>$post['num'],
		'sex'=>$post['sex'],
		'time'=>$post['time'],
		'iscar'=>$post['iscar'],
		'content'=>trim($post['content']),
		'status'=>0,
		'createtime'=>TIMESTAMP,
	);
	pdo_insert('jy_smallquan_guest',$insert);
	exi('已提交','','jy_smallquan/setguest/');
}
if($_RQ['op']=='add'){
	$post=get_postdata();
	if($post){
		
	}
	$return['post']=array('num'=>1,'sex'=>1);
	exi($return);
}
if($_RQ['op']=='detail'){
	$id=$_RQ['id'];
	if(!$id){
		exi('未找到该邀请','error','goback');
	}
	$return['item']=pdo_get('jy_smallquan_guest',array('id'=>$id,'uniacid'=>$_SESSION['uniacid']));;
	exi($return);
}